<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-wms__stock}">
      <wms-form v-model="dataForm" :formList="formList" :table-column="tableColumn" :advanced="advanced"
        @check-change="checkChange" @changeAdvance="changeAdvance" @getDataList="getDataList" @getReset="getReset">
        <el-form-item>
          <el-button type="primary" plain @click="exportHandle">库存导出
          </el-button>
        </el-form-item>
      </wms-form>
      <wms-table ref="wmsTable" class="stockTable" v-model="dataForm" :page="page" :total="total" :limit="limit"
        :tableData="dataList" :table-column="column" :module-options="mixinViewModuleOptions"
        :dataListLoading="dataListLoading" :showSelection="true"
                 @selection-change="handleSelectionChange"
                 @pageSizeChangeHandle="pageSizeChangeHandle"
                 @pageCurrentChangeHandle="pageCurrentChangeHandle"/>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from "@/mixins/view-module";
import AddOrUpdate from "./components/stock-add-or-update";
import debounce from "lodash/debounce";
import { formList, tableColumn } from './config'
import wmsTable from '@/components/wms-table'
import wmsForm from '@/components/wms-form'
export default {
  mixins: [mixinViewModule],
  data() {
    return {
      mixinViewModuleOptions: {
        getDataListURL: "/wms/stock/pageByZoneNo",
        getDataListIsPage: true,
        exportURL: "/wms/stock/byZoneNoExport",
        deleteURL: "/wms/stock",
        deleteIsBatch: true,
        deleteIsBatchKey: 'stockId'
      },
      dataForm: {
        spuNo: '',
        spuName: '',
        contNo: '',
        curPosition: ''
      },
      changeForm: {
        stockId: '',
        lockSt: ''
      },
      errorContAddVisible:false,
      selectedIds: [],
      formList,
      tableColumn,
      column: [],
      advanced: false
    };
  },
  components: {
    AddOrUpdate,
    wmsTable,
    wmsForm
  },
  methods: {
    //0.重置搜索框
    getReset() {
      this.dataForm = this.$options.data().dataForm;
    },
    // 处理表格多选
    handleSelectionChange(selection) {
      this.selectedIds = selection.map(item => item.stockId)
    },

  }
}
</script>
<style scoped lang="scss">
/* 隐藏表头的全选框 */
::v-deep .stockTable thead .el-table-column--selection .cell {
  display: none;
}
</style>
